<template>
  <div>
    <el-row :gutter="20">
      <el-col :span="8" :offset="8">
        <div>
          <div style="display: flex">
            <div class="back-icon" @click="backPage">
              <i class="el-icon-arrow-left"></i>
            </div>
            <h3 class="header-title">{{ evaluate.title }}</h3>
            <!-- <h3 class="count-div">{{ evaluate.title }}</h3> -->
          </div>

          <div class="count-div">
            <div class="my-font count-div-div">
              共{{ evaluate.topiccount }}道心理测试题
            </div>
            <div class="my-font count-div-div">
              {{ evaluate.evacount }}人已测
            </div>
            <div class="my-font count-div-div">
              {{ evaluate.evareplycount }}人评论
            </div>
          </div>
          <div style="margin: 30px 0px 10px 10px">
            <!-- 图片 -->
            <el-image
              style="width: 30vw; height: 40vh"
              :src="evaluate.cover"
              fit="fit"
            ></el-image>
          </div>
          <div class="brief-div my-font">
            {{ evaluate.brief }}
          </div>
        </div>
        <div>
          <el-button type="primary" class="start-btn" @click="toQuestionsPage"
            >开始测试</el-button
          >
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  created() {
    console.log(this.$route.params.evaluateId);
    this.evaluateId = this.$route.params.evaluateId;
    this.init();
  },
  data() {
    return {
      evaluateId: "", //id
      evaluate: {
        title: "", //标题
        topiccount: 0, //题目数量
        evacount: 0, //测试人数
        evareplycount: 0, //回复人数
        cover: "", //封面
        brief: "", //简介
      },
    };
  },
  methods: {
    init() {
      this.$request.getHttp({
        url: "/evaluate/getEvaluateById",
        params: { evaluateId: this.evaluateId },
        success: (data) => {
          if (data.code == 200) {
            this.evaluate = data.evaluate;
          }
        },
        error: (error) => {},
      });
    },
    //进入测试
    toQuestionsPage() {
      let path =
        "/evaluation/evaluationdetail/" + this.evaluateId + "/evaquestions";
      this.$router.push(path);
    },
    //返回上一页
    backPage() {
      this.$router.back();
    },
  },
};
</script>

<style scoped>
.back-icon {
  width: 2vw;
  font-size: 25px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-title {
  width: 27vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

.count-div {
  display: flex;
  align-items: center;
  justify-content: center;
}
.count-div-div {
  width: 10vw;
  display: flex;
  align-items: center;
  justify-content: center;
}

.my-font {
  color: #999;
}

.brief-div {
  margin: 10px 0px 0px 10px;
  width: 30vw;
}
.start-btn {
  margin-top: 10px;
  margin-left: 10px;
  width: 30vw;
}
</style>